package io.renren.modules.sys.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.sys.dao.CaseDao;
import io.renren.modules.sys.entity.CaseEntity;
import io.renren.modules.sys.service.CaseService;


@Service("caseService")
public class CaseServiceImpl extends ServiceImpl<CaseDao, CaseEntity> implements CaseService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
    	String title = (String)params.get("title");
        Page<CaseEntity> page = this.selectPage(
                new Query<CaseEntity>(params).getPage(),
                new EntityWrapper<CaseEntity>()
                .like(StringUtils.isNotBlank(title),"title={0}", title)
                .orderBy("upd_date", false)
        );

        return new PageUtils(page);
    }

}
